#include "stdafx.h"
#include "TestBox.h"
#include "UEBox.h"
#include "UEEntityOperation.h"

CPPUNIT_TEST_SUITE_REGISTRATION( TestBox );


TestBox::TestBox()
{
}


TestBox::~TestBox()
{
}

void TestBox::testCreate()
{
	double dx;
	double dy;
	double dz;
	AcGePoint3d Base;
	AcGeVector3d vx;
	AcGeVector3d vz;

	dx = 100;
	dy = 200;
	dz = 300;
	Base = AcGePoint3d::kOrigin;
	vx = AcGeVector3d::kXAxis;
	vz = AcGeVector3d::kZAxis;

	CUEBox Box;
	
	Box.Set( Base, vx, vz, dx, dy, dz );
	
	AcDb3dSolid* pSolid = Box.Create();

	Acad::ErrorStatus es = CUEEntityOperation::AddEntityToDwg( pSolid );
	if ( es != Acad::eOk )
	{
		delete pSolid;
	}
	pSolid->close();
}

void TestBox::testErrorCreate()
{
	double dx;
	double dy;
	double dz;
	AcGePoint3d Base;
	AcGeVector3d vx;
	AcGeVector3d vz;

	dx = 100;
	dy = -300;
	dz = 300;
	Base = AcGePoint3d::kOrigin;
	vx = AcGeVector3d::kXAxis;
	vz = AcGeVector3d::kZAxis;

	CUEBox Box;
	
	Box.Set( Base, vx, vz, dx, dy, dz );
	AcDb3dSolid* pSolid	= NULL ;
	try
	{
		 pSolid = Box.Create();
	}
	catch ( CString& strError ) 
	{
		CPPUNIT_NS::Asserter::fail( (LPCTSTR)strError );
	}

	Acad::ErrorStatus es = CUEEntityOperation::AddEntityToDwg( pSolid );
	if ( es != Acad::eOk )
	{
		delete pSolid;
	}
	pSolid->close();

}
